<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../../common/tag.jsp"%>
<html>
<head>
<title>场景二维码设置</title>
<meta name="referrer" content="never">
<%@ include file="../../common/header.jsp"%>
<link href="${ctx }/css/plugins/validator/validator.css"
	rel="stylesheet">
<link href="${ctx }/css/plugins/dataTables/datatables.min.css"
	rel="stylesheet">
<link href="${ctx }/css/plugins/clockpicker/clockpicker.css"
	rel="stylesheet">
<link href="${ctx }/css/plugins/chosen/chosen.css" rel="stylesheet">
</head>
<body class="gray-bg">

	<div class="wrapper wrapper-content animated fadeIn">

		<div class="row">
			<div class="col-lg-8">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>场景二维码编辑</h5>
					</div>
				</div>

				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>基本设置</h5>

					</div>
					<div class="ibox-content">
						<form class="form-horizontal"
							action="${ctx }/weixin/saveSceneQrcode" id="myForm" method="post"
							role="form">

							<div class="form-group">
								<label class="col-sm-3 control-label"><span
									style="color: red">*</span>场景名称</label>
								<div class="col-sm-6">
									<input class="form-control" id="name" name="name"
										placeholder="请输入场景名称" type="text" maxlength="64"
										value="${sceneQrcode.name }">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label"><span
									style="color: red">*</span>二维码类型</label>
								<div class="col-sm-6">
									<label class="checkbox-inline"> <input type="radio"
										${sceneQrcode.id == 0?"":"disabled" } value="0"
										checked="checked" name="limitType"> 临时
									</label> <label class="checkbox-inline"> <input type="radio"
										${sceneQrcode.id == 0?"":"disabled" } value="1"
										name="limitType"> 永久
									</label>
								</div>
							</div>
							<div class="form-group" id="expiredTimeContainer">
								<label class="col-sm-3 control-label">过期时间</label>
								<div class="col-sm-6">
									<input class="form-control" id="expiredTime" name="expiredTime"
										${sceneQrcode.id == 0?"":"disabled" } placeholder="请输入过期时间"
										type="text"
										value="<fmt:formatDate value="${ sceneQrcode.expiredTime }"
										pattern="yyyy/MM/dd HH:mm" />">


								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label"><span
									style="color: red">*</span>消息类型</label>
								<div class="col-sm-6">
									<select class="form-control" id="msgType" name="msgType">
										<option value="1"
											<c:if test="${message.msgType=='1'}">selected="selected"</c:if>>文本</option>
										<option value="2"
											<c:if test="${message.msgType=='2'}">selected="selected"</c:if>>图片</option>
										<option value="3"
											<c:if test="${message.msgType=='3'}">selected="selected"</c:if>>图文</option>
										<option value="4"
											<c:if test="${message.msgType=='4'}">selected="selected"</c:if>>自定义图文</option>
									</select>
								</div>
							</div>
							<div class="form-group" id="replyTextContainer">
								<label class="col-sm-3 control-label">文本内容</label>
								<div class="col-sm-6">
									<textarea class="form-control" cols="20" id="replyText"
										name="replyText" placeholder="回复文本" rows="4"
										value="${message.replyText }">${message.replyText }</textarea>
								</div>
							</div>
							<div class="form-group" id="picContainer" style="display: none;">
								<label class="col-sm-3 control-label">图片内容</label>
								<div class="col-sm-6">
									<div class="input-group">
										<input class="form-control" id="imageMediaId"
											name="imageMediaId" placeholder="请选择图片" type="text"
											readonly="readonly" value="${message.mediaId }" /> <span
											class="input-group-btn">
											<button type="button" class="btn btn-primary"
												onclick="fileIcon.click()">...</button> <input type="file"
											id="fileIcon" name="fileIcon" class="opacity_0"
											style="display: none;">
										</span>
									</div>
								</div>
							</div>
							<div class="form-group" id="mpnewsContainer"
								style="display: none;">
								<label class="col-sm-3 control-label">图文内容</label>
								<div class="col-sm-6">
									<div class="input-group">
										<input class="form-control" id="mpnewsMediaId"
											name="mpnewsMediaId" placeholder="请选择图文" type="text"
											readonly="readonly" value="${message.mediaId }" /> <span
											class="input-group-btn">
											<button type="button" id="btnSelectNews"
												class="btn btn-primary">...</button>
										</span>
									</div>
								</div>
							</div>

							<div id="newsContainer" style="display: none;">

								<c:forEach items="${newsList }" var="item" varStatus="status">
									<div _index="${status.index + 1}" class="newsItem"
										style="border: 0px solid #ccc;">
										<div class="form-group" id="replyTextContainer">
											<label class="col-sm-3 control-label">图文标题</label>
											<div class="col-sm-6">
												<input class="form-control"
													id="newsTitle${status.index + 1}"
													name="newsTitle${status.index + 1}" placeholder="请输入图文标题"
													type="text" maxlength="64" value="${item.title }">
											</div>
										</div>
										<div class="form-group" id="replyTextContainer">
											<label class="col-sm-3 control-label">图文描述</label>
											<div class="col-sm-6">
												<input class="form-control" id="newsDesc${status.index + 1}"
													name="newsDesc${status.index + 1}" placeholder="请输入图文描述"
													type="text" maxlength="64" value="${item.description }">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">媒体图片</label>
											<div class="col-sm-6">
												<div class="input-group">
													<input class="form-control" id="picUrl${status.index + 1}"
														name="picUrl${status.index + 1}" placeholder="请选择媒体图片"
														type="text" readonly="readonly" value="${item.picUrl }" />
													<span class="input-group-btn">
														<button type="button" class="btn btn-primary"
															onclick="filePicUrl${status.index + 1}.click()">...</button>
														<input type="file" id="filePicUrl${status.index + 1}"
														name="filePicUrl${status.index + 1}"
														container="picUrl${status.index + 1}" class="opacity_0"
														style="display: none;">
													</span>
												</div>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label">跳转链接</label>
											<div class="col-sm-6">
												<input class="form-control" id="linkUrl${status.index + 1}"
													name="linkUrl${status.index + 1}" placeholder="请输入跳转链接"
													type="text" maxlength="500" value="${item.linkUrl }">
											</div>
										</div>
									</div>
								</c:forEach>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">优惠券模板ID</label>
								<div class="col-sm-6">
									<select class="chosen-select form-control"
										name="couponTemplateId" id="couponTemplateId">
										<option value="">请选择模版</option>
										<c:forEach items="${wxCardConfigList}" var="wxCardConfig">
											<option value="${wxCardConfig.templateId}"
												<c:if test="${sceneQrcode.couponTemplateId==wxCardConfig.templateId}">selected</c:if>>${wxCardConfig.name}</option>
										</c:forEach>
									</select>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" id="btnSave" class="btn btn-primary">保
									存</button>
								<button type="button" id="btnClose" class="btn btn-default">取
									消</button>
								<input type="hidden" id="id" name="id"
									value="${sceneQrcode.id }" /> <input type="hidden"
									id="tmpLimitType" name="tmpLimitType"
									value="${sceneQrcode.limitType }" /> <input type="hidden"
									id="messageId" name="messageId"
									value="${sceneQrcode.messageId }" /> <input type="hidden"
									id="newsJson" name="newsJson" value="" />
							</div>
						</form>
					</div>
				</div>


			</div>

			<div class="col-lg-4"></div>
		</div>

	</div>


	<div id="showNewsModal" class="modal fade">
		<div class="modal-dialog" style="width: 800px;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title">选择图文素材</h4>
				</div>

				<div class="modal-body">

					<div class="table-responsive">
						<div class="dataTables_info" id="DataTables_Table_0_info"
							role="status" aria-live="polite">
							总共：<span id="item_total">0</span>
						</div>
						<table class="table table-striped table-bordered table-hover">
							<thead>
								<tr>
									<th>标题</th>
									<th>缩略图</th>
									<th>摘要</th>
									<th>选择</th>
								</tr>
							</thead>
							<tbody id="newsContent">

							</tbody>
						</table>
						<div class="dataTables_paginate paging_simple_numbers">

							<ul class="pagination">
								<li class="paginate_button previous"
									id="DataTables_Table_0_previous"><a href="#"
									aria-controls="DataTables_Table_0">上一页</a></li>
								<li class="paginate_button next disabled"
									id="DataTables_Table_0_next"><a href="#"
									aria-controls="DataTables_Table_0">下一页</a></li>
							</ul>
						</div>
					</div>
				</div>


				<div class="modal-footer">
					<button type="button" id="btnSaveNews" class="btn btn-primary">保
						存</button>
					<button type="button" id="btnCloseBind" class="btn btn-default"
						data-dismiss="modal">取 消</button>
				</div>
			</div>
		</div>
	</div>

</body>
</html>
<%@ include file="../../common/footer.jsp"%>
<script src="${ctx }/js/plugins/validator/validator.js"></script>
<script src="${ctx }/js/plugins/layer/laydate/laydate.js"></script>
<script src="${ctx }/js/plugins/ajaxfileupload.js"></script>
<script src="${ctx }/js/plugins/chosen/chosen.jquery.js"></script>
<script>
	var options = {

	};
</script>
<script src="${ctx }/js/view/weixin/sceneQrcodeEdit.js?v=22"></script>
